import jsonschema
schema={
    "type":"object",
    "properties":{
        "success":{"type":"boolean"},
        "code":{"type":"integer"},
        "message":{"pattern":"登录成功$"},
        "data":{
            "type":"object",
            "properties":{
                "age":{"const":20},
                "name":{"const":"lily"}
            },
            "required":["age","name"]
        }


    },
    "required":["success","code","message","data"]
}
json_data= {
    "success":False,
    "code":10000,
    "message":"xxx登录成功",
    "data":{
        "age":20,
        "name":"lily"
    }
}
res=jsonschema.validate(instance=json_data,schema=schema)
print("校验结果:",res)